﻿using zijian666.Data;

namespace zijian666.Data;

/// <summary>
/// 数据库操作拦截器基类
/// </summary>
public class DbInterceptorBase : IDbInterceptor
{
    public virtual CancellationToken CancellationToken => CancellationToken.None;
    public virtual ValueTask CommandCreated(DbCommandCreatedInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask QueryStarting(DbExecuteReaderInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask QueryExecuted(DbExecuteReaderInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask NonQueryExecuted(DbExecuteNonQueryInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask TransactionStarting(DbTransactionInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask TransactionCommitted(DbTransactionInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask TransactionRollbacked(DbTransactionInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask ConnectionStateChanging(DbConnectionInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask ExceptionOccurred(DbExceptionContext context) => ValueTask.CompletedTask;
    public virtual ValueTask EntityInserting(DbEntityInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask EntityUpdateing(DbEntityInterceptorContext context) => ValueTask.CompletedTask;
    public virtual ValueTask EntityDeleting(DbEntityInterceptorContext context) => ValueTask.CompletedTask;

    public ValueTask EntityInserted(DbEntityInterceptorContext context) => ValueTask.CompletedTask;

    public ValueTask EntityUpdated(DbEntityInterceptorContext context) => ValueTask.CompletedTask;

    public ValueTask EntityDeleted(DbEntityInterceptorContext context) => ValueTask.CompletedTask;
}
